
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 1
 * @Author : WangRuoyu 
 * @Date : 2023/5/17 15:04
 */

#include "iostream"

using namespace std;

bool check(int x) {
    if (x % 7 == 0) return false;
    string strx = to_string(x);
    for (char i: strx) {
        if (i == '7') return false;
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    int t = 1;
    int skip[4] = {0};

    while (n > 0) {
        if (check(t)) {
            n--;
        } else {
            skip[(t - 1) % 4]++;
        }
        t++;
    }

    for (int i: skip) {
        cout << i << endl;
    }

    return 0;
}